<template>
  <div>
    手机号：<i-input type="text" v-model="phone" placeholder="请输入密码" style="width: 300px"></i-input>
    <br/>
    <br/>
    合伙人等级：
    <i-select v-model="level"  style="width:200px">
        <i-option v-for="item in levelList" :value="item.value" :key="item.value">{{ item.label }}</i-option>
    </i-select>
    <br/>
    <br/> <br/>
    <br/> <br/>
    <br/>
    <br/>
    <br/> <br/>
    <br/> <br/>
    <br/>
    <i-button type="info"  @click="handleAddManager">修改</i-button>
  </div>

</template>

<script>
import axios from 'axios'
export default {
  name: 'UserJihuo',
  data () {
    return {
      phone:'',
      levelList: [
        {
            value: '0',
            label: '普通用户 '
        },
        {
            value: '1',
            label: '银牌代理'
        },
        {
            value: '2',
            label: '金牌代理'
        },
        {
            value: '3',
            label: '钻石代理'
        }
      ],
      level: ''
    }
  },
  methods: {
    handleAddManager(){
      if(this.jianyan()){
        axios.post('/web/api/manager/initPartner',{"phone":this.phone,"level":this.level}).then(this.handleAddInfoSucc)
      }
    },
    handleAddInfoSucc (res) {
      var data = res.data
      console.log('tag',data)
      this.$Message.success(data.message)
    },
    jianyan(){
      if(this.phone === ''){
        this.$Message.success("请输入手机号");
        return false;
      }else if(this.level === ''){
        this.$Message.success("请选择合伙人等级");
        return false;
      }else{
        return true
      }
    }
  }
}
</script>
<style lang="stylus" scoped>
.toback {
    width: 100%;
    font-size: 1.8rem;
    line-height: 2.6;
    background #358ff0
    p {
      text-align: center;
      color: #ffffff;
    }
}
</style>

